UserInfoWindow = function(obj){
	
	//window的发射窗体事件信息
	var fireselectevent = function(){
		var win = infogrid.ownerCt.ownerCt;
		var record = infogrid.getSelectionModel().getSelected();
		win.fireEvent('submit',win,infogrid,record.data);
		win.close();
	}
	
	//定义一个load方法给让表单加载数据信息
	var loadInfo = function(rec){
		
	}
	
	//获取表单信息并定义事件
	var submit = function(){
		fireselectevent();
		/*if(form.getForm().isValid()){*/
			/*var data = form.getForm().getValues();
		    var win = form.ownerCt;
		    win.fireEvent('submit',win,form,data);*/
		/*}else{
			Ext.MessageBox.alert('系统提示','请填写合适的数据!');
		}*/
		
	}
	//小区根节点
	var treeroot = new Ext.tree.AsyncTreeNode(
		{
			text:'小区名称',
			id:'0'
		}
	); 
	//树形列表loader
	var treeload = new Ext.tree.TreeLoader(
		{
			url:__ctxPath+'/back/area/findallareafortree.html'
		}
	);
	//树形机构列表
	var tree = new Ext.tree.TreePanel(
		{
			region:'west',
			title:'小区列表',
			width:200,
			loader:treeload,
			root:treeroot,
			autoScroll:true,
			listeners: {
	            click: function(n) {
	            	var data = {areaid:n.attributes.aid};
	                var _data = data;
					var _obj = {start:0,limit:20};
					Ext.apply(_obj,_data);
					storeinfo.baseParams = _obj;
					storeinfo.reload();
	            }
	        },
			height:300
		}
	);
	var data = [
		{name:'张三',telephone:'13933919637',address:'3-03-307'},
		{name:'李四',telephone:'13912345678',address:'1-03-308'},
		{name:'王五',telephone:'13987654321',address:'4-03-309'}
	];
	var cm = [
		new Ext.grid.RowNumberer(),
		{header:'用户名称',dataIndex:'username',sortable: true,width:100},
		{header:'联系电话',dataIndex:'telephone',sortable: true,width:100},
		{header:'地址',dataIndex:'address',sortable: true,width:400}
	];
	var storeinfo = new Ext.data.JsonStore(
		{
			url:__ctxPath+'/back/userunit/findallusers.html',
			totalProperty:'totalCount',
			root:'data',
			baseParams:{start:0,limit:20},
//			autoLoad:true,
			remoteSort:true,
			autoLoad:true,
			fields:['username','telephone','address']
		}
	);
	var bbar = [
		new Ext.PagingToolbar(
			{
				 store: storeinfo,       // grid and PagingToolbar using same store
        		 displayInfo: true,
        		 pageSize: 20,
        		 plugins: new Ext.ux.ProgressBarPager({progBarWidth:400})
			}
		)
	];
	//数据信息
	var infogrid = new Ext.grid.GridPanel(
		{
			bbar:bbar,
			region:'center',
			title:'在列表中选择具体人员后,请点击【确定】按钮',
			height:300,
			width:500,
			store:storeinfo,
			columns:cm
		}
	);
	//infogrid中每一行的双击事件
	var rowdblclick = function(persongridinfo,rowindex,e){
		var win = persongridinfo.ownerCt.ownerCt;
		var record = persongridinfo.getSelectionModel().getSelected();
		win.fireEvent('submit',win,persongridinfo,record.data);
		win.close();
	};
	infogrid.on('rowdblclick',rowdblclick);
	//panel数据信息
	var panel = new Ext.Panel(
		{
			layout:'border',
			height:300,
			items:[tree,infogrid],
			width:500
		}
	);
	//这里是Window的配置项
	var config = {
		//load:loadInfo,
		buttons:[
			{
				text:'确定',
				iconCls:'confirm',
				handler:submit,
				scope:this
			},
			{
				text:'取消',
				iconCls:'cancel',
				handler:function(){this.close()},
				scope:this
			}],
		items:[panel],
		layout:'fit',
		constrain : true, 
		constrainHeader : true, 
		modal:true,
		title:obj.title,
		width:850,
		height:300,
		autoHeight:true 
	};
	UserInfoWindow.superclass.constructor.call(this,config);
}
Ext.extend(UserInfoWindow,Ext.Window);